package com.fire.control.system.module.file.dao;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import com.fire.control.system.dto.app.AppFileVo;
import com.fire.control.system.entity.File;

/**
 * 
 * @ClassName:  FileRepository
 * @Description:  文件持久层
 * @author:  xiechengguang
 * @date:  2017年6月8日 下午7:44:05
 *
 */
@Repository 
public interface FileRepository extends JpaRepository<File, String>{
	
	@Query("from File f where f.relationId = :rid")
	public List<File> findByRelationId(@Param("rid") String rid);
	
	@Transactional
	@Modifying
	@Query("update File f set f.relationId = :relationId where f.id = :fid")
	public int updateRelation(@Param("fid") String fid, @Param("relationId") String relationId);
	
	
}
